export default {

    users: {
        columns: [
            {
                key: "username",
                name: "用户名",
                editable: true,     // 当表格可编辑时当前列是否可编辑
                /**
                 * [comp description]
                 * @param  {[bool]}     tableEditable  [表格的编辑状态]
                 * @param  {[bool]}     columnEditable [列的编辑状态]
                 * @param  {[array]}    data           [表格渲染数据]
                 * @param  {[number]}   rowindex       [当前行号]
                 * @param  {[object]}   rowDatum       [当前行数据]
                 * @param  {[string]}   key            [当前行数据的渲染属性名]
                 * @param  {[???]}      value          [渲染数据]
                 * @return {[type]}                    [渲染组件]
                 */
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    var editable = tableEditable && columnEditable;
                    editable = editable && (index % 2 === 1);
                    if(editable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "birthdate",
                name: "出生日期",
                editable: true,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "gender",
                name: "性别",
                editable: false,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "preLoginDatetime",
                name: "上次登录时间",
                editable: false,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            }
        ],
        data: [
            {
                username: "艾希",
                birthdate: "1991-12-12",
                gender: "女",
                preLoginDatetime: "2017-08-08 12:12:12"
            },
            {
                username: "艾克",
                birthdate: "1992-12-12",
                gender: "男",
                preLoginDatetime: "2017-12-08 12:12:12"
            },
            {
                username: "艾尔文",
                birthdate: "1992-12-12",
                gender: "男",
                preLoginDatetime: "2017-12-08 12:12:12"
            },
            {
                username: "阿尔敏",
                birthdate: "1992-12-12",
                gender: "男",
                preLoginDatetime: "2017-12-08 12:12:12"
            },
            {
                username: "艾伦",
                birthdate: "1992-12-12",
                gender: "男",
                preLoginDatetime: "2017-12-08 12:12:12"
            }
        ]
    },

    employees: {
        columns: [
            {
                key: "employeeName",
                name: "员工姓名",
                editable: true,     // 当表格可编辑时当前列是否可编辑
                /**
                 * [comp description]
                 * @param  {[bool]}     tableEditable  [表格的编辑状态]
                 * @param  {[bool]}     columnEditable [列的编辑状态]
                 * @param  {[array]}    data           [表格渲染数据]
                 * @param  {[number]}   rowindex       [当前行号]
                 * @param  {[object]}   rowDatum       [当前行数据]
                 * @param  {[string]}   key            [当前行数据的渲染属性名]
                 * @param  {[???]}      value          [渲染数据]
                 * @return {[type]}                    [渲染组件]
                 */
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    var editable = tableEditable && columnEditable;
                    editable = editable && (index % 2 === 1);
                    if(editable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "contactPhoneNo",
                name: "联系电话",
                editable: true,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "hiredate",
                name: "入职日期",
                editable: false,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            },
            {
                key: "salary",
                name: "工资",
                editable: false,
                geneComp: function(tableEditable, columnEditable, data, datum, index, key, value){
                    if(tableEditable && columnEditable){
                        return "<input type='input' value='" + value + "'/>";
                    } else {
                        return "<span>" + value + "</span>";
                    }
                }
            }
        ],
        data: [
            {
                employeeName: "艾希",
                hiredate: "1991-12-12",
                salary: "10000",
                contactPhoneNo: "123456"
            },
            {
                employeeName: "艾克",
                hiredate: "1992-12-12",
                salary: "12000",
                contactPhoneNo: "333333"
            },
            {
                employeeName: "艾尔文",
                hiredate: "1992-12-12",
                salary: "20000",
                contactPhoneNo: "666666"
            },
            {
                employeeName: "阿尔敏",
                hiredate: "1992-12-12",
                salary: "18000",
                contactPhoneNo: "777777"
            },
            {
                employeeName: "艾伦",
                hiredate: "1992-12-12",
                salary: "16000",
                contactPhoneNo: "888888"
            }
        ]
    }


}